<template>
  <div>

  <van-nav-bar
    title="新建收货人"
    left-text="返回"
    left-arrow
    @click-left="onClickLeft"
  />
  <van-address-edit
    :area-list="areaList"
    show-postal
    show-delete
    show-set-default
    show-search-result
    :search-result="searchResult"
    :area-columns-placeholder="['请选择', '请选择', '请选择']"
    @save="onSave"
    @delete="onDelete"
    @change-detail="onChangeDetail"
  />
  </div>
</template>

<script>
  import { Toast } from 'vant';

  import bus from '../utils/bus.js'

  export default {
    data() {
      return {
        areaList:{
          province_list:{
            11: "北京市",
            12: "天津市",
            13: "河北省",
            14: "山西省",
            15: "内蒙古自治区",
          },
          city_list:{
            1101: "市辖区"
          },
          county_list:{
            110101: "东城区",
            110102: "西城区",
            110105: "朝阳区",
            110106: "丰台区",

          }
        },
        searchResult: [],
      };
    },
    methods: {
      onSave() {
        Toast('save');
      },
      onDelete() {
        Toast('delete');
      },
      onChangeDetail(val) {
        if (val) {
          this.searchResult = [
            {
              name: '黄龙万科中心',
              address: '杭州市西湖区',
            },
          ];
        } else {
          this.searchResult = [];
        }
      },
      onClickLeft() {
        this.$router.go(-1)
      },
      onClickRight() {
        Toast('按钮');
      },
    },
  };
</script>

<style scoped>

</style>
